/*------------------------------------------------------------------------------
 * PROJ : TestCase
 * NAME : SimpleDateFormatTest
 * DESC : 
 * Author : Hosung.Seo
 * VER  : v1.0  * 
 * Copyright 2008 LG CNS All rights reserved
 *------------------------------------------------------------------------------
 *                  Change History                      
 *------------------------------------------------------------------------------
 *    DATE     AUTHOR                      DESCRIPTION                        
 * ----------  ------  --------------------------------------------------------- 
 * 2008. 11. 11.  Hosung  First released.                
 *------------------------------------------------------------------------------
 */
package dateTest;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

import junit.framework.TestCase;

/**
 * <PRE>
 * 
 * </PRE>
 * 
 * @author Hosung.Seo
 * @version 2008. 11. 11.
 * @see SimpleDateFormatTest
 */
public class SimpleDateFormatTest extends TestCase {
	public void test() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",
				Locale.KOREA);
		SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ",
				Locale.KOREA);
		System.out.println(sdf.format(new Date()));
		System.out.println(sdf2.format(new Date()));

		// get present day / time.
		Calendar cld = Calendar.getInstance();

		System.out.println("This year: " + cld.get(Calendar.YEAR));
		System.out.println("This Month: " + (cld.get(Calendar.MONTH) + 1));
		System.out.println("Today: " + cld.get(Calendar.DAY_OF_MONTH));

		// display 24 hour pattern.
		System.out.println("This hour: " + cld.get(Calendar.HOUR_OF_DAY));
		System.out.println("This Minute: " + cld.get(Calendar.MINUTE));
		System.out.println("This Second: " + cld.get(Calendar.SECOND));

		// ///////////////////////////////////////////////////////////////
		String year = sdf.format(new Date()).substring(0, 4);
		int now = Integer.parseInt(year);
		while (2008 <= now) {
			System.out.println(now);
			now--;
		}
	}

}
